/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bsc.mina_test.service;

import com.bsc.minacommand.common.CommandState;
import static com.bsc.minacommand.common.CommandState.CONNECTED;
import com.bsc.minacommands.concrete.TestCommand;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.statemachine.annotation.IoHandlerTransition;
import static org.apache.mina.statemachine.event.IoHandlerEvents.MESSAGE_RECEIVED;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author penn.ma
 */
public class TestHandler extends CommandState {

    private static final Logger LOGGER = LoggerFactory.getLogger(TestHandler.class);

    @IoHandlerTransition(on = MESSAGE_RECEIVED, in = CONNECTED, next = PLAYING)
    public void Test(IoSession session, TestCommand comand) {
        LOGGER.info("测试指令1：" + comand.CommandName());
        LOGGER.info("测试指令2：" + comand.getTest());
        
       session.write(new TestCommand());
    }
}
